package hhj.demo.service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * TODO: description
 * @author huanghaijun
 * @since Aug 12, 2015
 */

@Service
public class DemoService {
    
    @Cacheable(value="TEST", key="'test'")
    public Map<String, Object> getContent() {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("a", 45);
        map.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        
        return map;
    }
    
    @CacheEvict(value="TEST", key="'test'")
    public void deleteCache() {
        
    }

}
